//
//  HLWebManager.m
//  zhuanxian
//
//  Created by zhaoliang chen on 2017/11/17.
//  Copyright © 2017年 huiling. All rights reserved.
//

#import "HLWebManager.h"
#import "HLNetManager.h"
#import "NSString+function.h"

NSString *const service = @"http://www.ydk56.com/app/";

@implementation HLWebManager

//登录接口
+ (BAURLSessionTask*)loginIn:(NSString*)username password:(NSString*)password successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"login.htm"] param:@{@"userName":username,@"passWord":[password aes128_encrypt:@"huilingp2ppublic"],@"orderNo":[NSString stringWithFormat:@"%zd",[[NSDate date] getTimeIntervalSince1970Millisecond]]} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取轮播图
+ (BAURLSessionTask*)getAdvertise:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getIndexImg.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取网点信息
+ (BAURLSessionTask*)getWebsites:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getWebsiteInfo.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

+ (BAURLSessionTask*)getWaybillList:(HLWaybillFiltrateObject*)model pageNumber:(NSInteger)pageNumber pageSize:(NSInteger)pageSize successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    NSMutableDictionary* dic = model.mj_keyValues;
    dic[@"pageNumber"] = @(pageNumber);
    dic[@"pageSize"] = @(pageSize);
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"waybillList.htm"] param:dic withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取联系人列表
+ (BAURLSessionTask*)getContactList:(ContactType)type name:(NSString*)name telephone:(NSString*)telephone successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    if (type == sender) {
        return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getConsignorInfo.htm"] param:@{@"name":name,@"telephone":telephone} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
    } else {
        return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getConsigneeInfo.htm"] param:@{@"name":name,@"telephone":telephone} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
    }
}

//开单
+ (BAURLSessionTask*)addWaybill:(HLWaybillDetailObject*)model successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"waybillAddSubmit.htm"] param:model.mj_keyValues withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//订单修改提交
+ (BAURLSessionTask*)submitWaybill:(HLWaybillDetailObject*)model successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"waybillUpdateSubmit.htm"] param:model.mj_keyValues withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取运单详情
+ (BAURLSessionTask*)getWaybillDetail:(NSString*)waybillId successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"waybillDetail.htm"] param:@{@"id":waybillId} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

+ (BAURLSessionTask*)cancellationWaybill:(NSString*)waybillId successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"waybillInvalid.htm"] param:@{@"ids":waybillId} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//消息列表
+ (BAURLSessionTask*)getMessageList:(NSInteger)pageNumber successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"messageList.htm"] param:@{@"pageNumber":[NSString stringWithFormat:@"%zd",pageNumber],@"pageSize":@"10"} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//意见反馈
+ (BAURLSessionTask*)feedbackAdd:(NSString*)content successBlock:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"feedbackAdd.htm"] param:@{@"content":content} withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//关于我们
+ (BAURLSessionTask*)aboutUs:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"aboutUs.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取常用包装
+ (BAURLSessionTask*)getPackingList:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getPackingList.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取常用送货方式
+ (BAURLSessionTask*)getServiceList:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getServiceList.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取常用的收货类型
+ (BAURLSessionTask*)getTransportTypeList:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getTransportTypeList.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取常用付款方式
+ (BAURLSessionTask*)getPaymentWayList:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getPaymentWayList.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

//获取常用附加跳跃
+ (BAURLSessionTask*)getAdditionalList:(BAResponseSuccessBlock)success failureBlock:(BAResponseFailBlock)failure {
    return [HLNetManager hl_requestWithGet:[service stringByAppendingString:@"getAdditionalList.htm"] param:nil withSuccessBlock:success withFailureBlock:failure progressBlock:nil];
}

@end
